/*
 *  Socket.h
 *  jscsh
 *
 *  Created by Jonathan Hohle on 1/15/08.
 *  Copyright 2008 hohle.net. All rights reserved.
 *
 */

#include <JavaScriptCore/JavaScriptCore.h>

void Socket_extendHost(JSContextRef context, JSObjectRef contextGlobalObject);

//
// Class Methods
//
JSValueRef Socket_s_getaddrinfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_s_gethostbyname(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_s_getservbyname(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);

JSClassRef Socket_class(JSContextRef context);
JSObjectRef Socket_construct(JSContextRef context, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
static void Socket_initialize(JSContextRef context, JSObjectRef object);
static void Socket_finalize(JSObjectRef object);

//
// Instance Methods
//
JSValueRef Socket_i_accept(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_acceptNonBlock(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_bind(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_connect(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_connectNonBlock(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_listen(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_recvfrom(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_recvfromNonBlock(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
JSValueRef Socket_i_sysAccept(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
